<script setup lang="ts" name="repair-index">
import {
  getCurrentInstance,
  defineComponent,
  onMounted,
  onActivated,
  reactive,
  ref,
  toRaw,
} from "vue";
import {
  getCameraList_,
  getAllCameraList_,
  getFullDeptTree_,
  getUserVideoUrl,
} from "@/api/server_video";
import { deviceInfo } from "@/api/server_set_patrol";
import { getDeviceList } from "@/api/server_repair";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import { useStore } from "vuex";
import { setAutoCheckALert, setAutoCheckData } from "@/utils/autoCheck";
import { deviceCount, detectionLog, deviceLog } from "@/api/server_repair";
import { deviceList } from "@/api/server_set_patrol";
import { getCameraVideoUrl } from "@/api/server_video";
import Bus from "@/utils/eventBus";
import b1 from "@/assets/image/equipment/a.jpg";
import b2 from "@/assets/image/equipment/b.jpg";
import b3 from "@/assets/image/equipment/c.jpg";
import b4 from "@/assets/image/equipment/d.jpg";
import b5 from "@/assets/image/equipment/e.jpg";
import b6 from "@/assets/image/equipment/f.jpg";
// 引入插件
import SwiperCore, {
  Navigation,
  Pagination,
  Scrollbar,
  Autoplay,
} from "swiper";
import { Swiper, SwiperSlide } from "swiper/vue";
import "swiper/scss";
import "swiper/scss/navigation";
import "swiper/scss/pagination";
import { indexOf } from "lodash";
import { getMaxListeners } from "process";
// import { id } from "element-plus/es/locale";
SwiperCore.use([Navigation, Pagination, Scrollbar, Autoplay]);
const router = useRouter();
const cameraList = ref<any[]>([]);
const isBig = ref(false);
const go = () => {
  router.push({ name: "page2", params: { a: 1 } });
};
const deviceCountInfo = ref<any>({
  monthReport: {},
  sevenDayReport: {},
  todayReport: {},
  yearReport: {},
});
const deviceLogInfoForm = ref<any>({
  page: 1,
  pageSize: 20,
});
const deviceLogRecordInfoToast = ref(0);
const deviceCountInfoTab = ref("todayReport");
const deviceCountInfoTabList = reactive({
  todayReport: "今日",
  sevenDayReport: "7日",
  monthReport: "30日",
  yearReport: "今年",
});
const getDeviceCount = async () => {
  let res = await deviceCount({});
  if (res.result == "success") {
    deviceCountInfo.value = res;
  }
};
const deviceLogForm = ref<any>({
  page: 1,
  pageSize: 20,
});
const deviceLogDialogTitle = ref();
const deviceLogDialogVisible = ref(false);
const deviceLogRecordInfo = ref<any>([]);
const activeNames = ref();
const innerVisible = ref(false);
const deviceLogList = ref<any[]>([]);
const deviceLogTatal = ref(0);
const statusMap = reactive<any>({
  normal: "正常",
  repairing: "维修中",
  broken: "报废",
});
const getDeviceLogInfo = (status: string, type: number) => {
  if (type == 1) {
    deviceCountInfoTab.value = "todayReport";
  }
  if (type == 2) {
    deviceCountInfoTab.value = "sevenDayReport";
  }
  if (type == 3) {
    deviceCountInfoTab.value = "monthReport";
  }
  if (type == 4) {
    deviceCountInfoTab.value = "yearReport";
  }
  let mapTitle: any = {
    todayReport: "今日",
    sevenDayReport: "7日",
    monthReport: "30日",
    yearReport: "今年",
  };
  deviceLogForm.value.page = 1;
  deviceLogForm.value.type = deviceCountInfoTab.value.replace("Report", "");
  deviceLogForm.value.status = status;
  deviceLogDialogTitle.value = mapTitle[deviceCountInfoTab.value];
  deviceLogDialogVisible.value = true;
  getDeviceLog();
};
const getDeviceLog = async () => {
  let res = await deviceLog({
    ...deviceLogForm.value,
  });

  if (res.result == "success") {
    deviceLogList.value = res.list;
    deviceLogTatal.value = Number(res.total);
    console.log("deviceLogList.value", deviceLogList.value);
  }
};
const deviceLogRecord = async (data: any) => {
  innerVisible.value = true;
  deviceLogRecordInfo.value = [];
  let res = await deviceLog({
    id: data.device_log_id,
    ...deviceLogInfoForm.value,
  });
  if (res.result == "success") {
    deviceLogRecordInfo.value = res.list;
    deviceLogRecordInfoToast.value = Number(res.total);
  }
};
const deviceLogInfoHandleCurrentChange = (page: number) => {
  deviceLogInfoForm.value.page = page;
};
const deviceLogHandleCurrentChange = (page: number) => {
  deviceLogForm.page = page;
  getDeviceLog();
};
onMounted(() => {
  getDeviceCount();
  getAllCameraList();
  getList(0);
});

const getList = async (page: number) => {
  let res = await getDeviceList({
    page: page || 1,
  });
  console.log(res, "aaaaaa");
  if (res.result == "success") {
    // lists.value = res.list
  }
};
const list = reactive([b1, b2, b3, b4, b5, b6, b5, b1, b2, b3, b4, b5, b6, b5]);

// 实时动态
const lists = reactive([
  {
    img: b1,
    name: "周利民",
    time: "08-19 12:17",
    go: "设备一",
    department: "工艺部",
    tempe: "正常",
  },
  {
    img: b2,
    name: "王立厚",
    time: "08-19 12:24",
    go: "设备二",
    department: "工艺部",
    tempe: "正常",
  },
  {
    img: b3,
    name: "张大都",
    time: "08-19 12:14",
    go: "设备三",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b4,
    name: "李东飞",
    time: "08-19 12:48",
    go: "设备四",
    department: "工艺部",
    tempe: "正常",
  },
  {
    img: b5,
    name: "安智会",
    time: "08-19 12:13",
    go: "设备五",
    department: "工艺部",
    tempe: "正常",
  },
  {
    img: b6,
    name: "刘成军",
    time: "08-19 12:36",
    go: "设备六",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b5,
    name: "曹晨曦",
    time: "08-19 12:26",
    go: "设备七",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b1,
    name: "周利民",
    time: "08-19 12:17",
    go: "设备八",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b2,
    name: "王立厚",
    time: "08-19 12:24",
    go: "设备九",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b3,
    name: "张大都",
    time: "08-19 12:14",
    go: "设备十",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b4,
    name: "李东飞",
    time: "08-19 12:48",
    go: "设备十一",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b5,
    name: "安智会",
    time: "08-19 12:13",
    go: "设备十二",
    department: "工艺部",
    tempe: "正常",
  },
  {
    img: b6,
    name: "刘成军",
    time: "08-19 12:36",
    go: "设备十三",
    department: "工程一部",
    tempe: "正常",
  },
  {
    img: b5,
    name: "曹晨曦",
    time: "08-19 12:26",
    go: "设备十四",
    department: "工艺部",
    tempe: "正常",
  },
]);

//图片弹窗
const indexitem = ref({
  img: "",
});
const indexs = (index: any) => {
  console.log("index", index);
  indexitem.value.img = lists[index].img;
};

const phonedialogVisible = ref(false);
const tablee = (page: number) => {
  console.log(page);
};
const phonehandleClose = (done: () => void) => {
  ElMessageBox.confirm("Are you sure to close this dialog?")
    .then(() => {
      done();
    })
    .catch(() => {
      // catch error
    });
};

const getAllCameraList = async () => {
  let res = await deviceList({});
  if (res.result == "success") cameraList.value = res.list;
};

const returnCameraIndex = (data: any) => {
  if (!data) {
    return;
  }
  let coordinate = data.coordinate || "";
  let left = coordinate.split(",")[0];
  let top = coordinate.split(",")[1];
  return { top: `${top}px`, left: `${left}px` };
};

const doubleclick = (event: any) => {
  isBig.value = !isBig.value;
  if (!isBig.value) {
    setMap();
    return;
  }
  let offsetX = event.offsetX;
  let offsetY = event.offsetY;
  let mapBlock: any = document.querySelector(".map-block");
  let mapId: any = document.querySelector(".map-id");
  let mapBlockHeight = mapBlock.clientHeight;
  let mapBlockWidth = mapBlock.clientWidth;
  let mapIdHeight = mapId.clientHeight;
  let mapIdWidth = mapId.clientWidth;
  let left = -event.offsetX + mapBlockWidth / 2;
  let top = -event.offsetY + mapBlockHeight / 2;
  setTimeout(() => {
    if (left > 0) left = 0;
    if (left < mapBlockWidth - mapIdWidth) left = mapBlockWidth - mapIdWidth;
    if (top > 0) top = 0;
    if (top < mapBlockHeight - mapIdHeight) top = mapBlockHeight - mapIdHeight;
    mapId.style.transform = `scale(${1})`;
    mapId.style.left = `${left}px`;
    mapId.style.top = `${top}px`;
  }, 100);
  mapId.oncontextmenu = function () {
    return false;
  };

  mapId.addEventListener("mousedown", function (event: any) {
    event.stopPropagation();
    var code = event.which;
    if (code != 3 || !isBig.value) {
      return;
    }
    let left = parseInt(mapId.style.left);
    let top = parseInt(mapId.style.top);
    let ol = event.clientX;
    let ot = event.clientY;
    document.onmousemove = function (ev) {
      let l = left + ev.clientX - ol;
      let t = top + ev.clientY - ot;
      if (l > 0) l = 0;
      if (l < mapBlockWidth - mapIdWidth) l = mapBlockWidth - mapIdWidth;
      if (t > 0) t = 0;
      if (t < mapBlockHeight - mapIdHeight) t = mapBlockHeight - mapIdHeight;
      mapId.style.left = l + "px";
      mapId.style.top = t + "px";
    };
    document.onmouseup = function () {
      document.onmousemove = null;
    };
  });
};

const setMap = () => {
  let mapBlock: any = document.querySelector(".map-block");
  let mapId: any = document.querySelector(".map-id");
  mapId.style.opacity = 1;
  let mapBlockHeight = mapBlock.clientHeight;
  let mapBlockWidth = mapBlock.clientWidth;
  let mapIdHeight = mapId.clientHeight;
  let mapIdWidth = mapId.clientWidth;
  let zoomVal = mapBlockHeight / mapIdHeight;
  let left = (mapBlockWidth - mapIdWidth) / 2;
  let top = (mapBlockHeight - mapIdHeight) / 2;
  mapId.style.transform = `scale(${zoomVal})`;
  mapId.style.left = `${left}px`;
  mapId.style.top = `${top}px`;
  mapId.oncontextmenu = function () {
    return false;
  };
};
// 设备点击详情

const deviceDetaitem = ref<any>({
  // brand: "",
  // spec: "",
  // coordinate: "",
  // factory_phone: "",
  // dept_type: "",
});
const deviceDeta = async (data: any) => {
  let res: any = await deviceInfo({
    id: data.device_id,
  });

  if (res.result == "success") {
    deviceDetaitem.value = res.deviceInfo;
    // deviceDetaitem.value.brand = res.deviceInfo.brand;
    // deviceDetaitem.value.spec = res.deviceInfo.spec;
    // deviceDetaitem.value.coordinate = res.deviceInfo.coordinate;
    // deviceDetaitem.value.factory_phone = res.deviceInfo.factory_phone;

    // if (res.deviceInfo.dept_type == "inner") {
    //   deviceDetaitem.value.dept_type == "内部";
    // } else if (res.deviceInfo.dept_type == "outer") {
    //   deviceDetaitem.value.dept_type == "外部";
    // }

    console.log("详情", deviceDetaitem.value);
  }
};
const equipment = ref(false);
const cameraClick = (data: any) => {
  equipment.value = true;
  deviceDeta(data);
};
// const cameraClick = async (data: any) => {
//   let res = await getCameraVideoUrl({
//     id: data.camera_id,
//   });
//   if (res.result == "success") {
//     Bus.$emit("openVideo", res);
//   }
// };

onMounted(() => {
  getAllCameraList();
  setTimeout(() => {
    setMap();
  }, 500);
});
</script>

<template>
  <div class="repair-page">
    <!-- 预留项 -->
    <div class="visual-left">
      <div class="map-block">
        <div class="map-loading">地图加载中...</div>
        <div class="map-id" style="opacity: 0" @dblclick="doubleclick">
          <img class="map-image" src="@/assets/image/home/map.png" alt="" />
          <div
            class="index-point"
            :key="index"
            v-for="(c, index) in cameraList"
            :title="c.spec"
            @click="cameraClick(c)"
            :style="returnCameraIndex(c)"
          >
            <!--  <img src="../image/gif/index2.gif"> -->
            <div class="camera-hover">
              <img src="@/assets/image/home/shebei1.png" />
              <img class="hover" src="@/assets/image/home/shebei2.png" />
            </div>
          </div>
          <!-- <div
              class="index-point"
              v-for="(c, index) in ngListCarmeta"
              @click="cameraClickNgList(c, index)"
              :style="returnCameraIndex(c.cameraInfo)"
            >
              <img src="../image/gif/index2.gif" />
            </div> -->
        </div>
      </div>
    </div>
    <!-- 设备弹窗 -->
    <el-dialog v-model="equipment" title="设备信息" width="600px">
      <div class="deviceDeta-box">
        <div class="deviceDeta-l">
          <div>
            品牌：<span class="deviceDeta-l-span">{{
              deviceDetaitem.brand
            }}</span>
          </div>
          <div>
            型号：<span class="deviceDeta-l-span">{{
              deviceDetaitem.spec
            }}</span>
          </div>
          <div>
            位置：<span class="deviceDeta-l-span">{{
              deviceDetaitem.coordinate
            }}</span>
          </div>
        </div>
        <div class="deviceDeta-r">
          <div>
            电话：<span class="deviceDeta-l-span">{{
              deviceDetaitem.factory_phone
            }}</span>
          </div>
          <div>
            售后：
            <span
              class="deviceDeta-l-span"
              v-if="deviceDetaitem.dept_type == 'inner'"
              >内部</span
            >
            <span
              class="deviceDeta-l-span"
              v-if="deviceDetaitem.dept_type == 'outer'"
              >外部</span
            >
          </div>
          <div>
            状态：<span
              class="deviceDeta-l-status-a"
              v-if="deviceDetaitem.status == 'normal'"
              >正常</span
            >
            <span
              class="deviceDeta-l-status-b"
              v-if="deviceDetaitem.status == 'repairing'"
              >维修中</span
            >
            <span
              class="deviceDeta-l-status-c"
              v-if="deviceDetaitem.status == 'broken'"
              >报废</span
            >
          </div>
        </div>
      </div>
    </el-dialog>
    <div class="nestinga">
      <!-- 设备状态 -->
      <app-box class="device-configuration-block" :title="`设备状态`">
        <!-- 今日 -->
        <div class="repair-total-box-flex">
          <div class="nesting">
            <div class="tab-change">
              <span :class="{ active: true }">{{
                deviceCountInfoTabList.sevenDayReport
              }}</span>
            </div>
            <div class="tab-change">
              <span :class="{ active: true }">{{
                deviceCountInfoTabList.todayReport
              }}</span>
            </div>
          </div>
          <div class="layout">
            <div class="repair-total-box">
              <div class="item" @click="getDeviceLogInfo('', 1)">
                <p class="t">故障数</p>
                <p class="n">
                  {{ deviceCountInfo.todayReport.total }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('repairing', 1)">
                <p class="t">维修数</p>
                <p class="n">
                  {{ deviceCountInfo.todayReport.repairTotal }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('normal', 1)">
                <p class="t">已完成</p>
                <p class="n">
                  {{ deviceCountInfo.todayReport.normalTotal }}
                </p>
              </div>
            </div>
            <!-- 7日 -->
            <div class="repair-total-box">
              <div class="item" @click="getDeviceLogInfo('', 2)">
                <p class="t">故障数</p>
                <p class="n">
                  {{ deviceCountInfo.sevenDayReport.total }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('repairing', 2)">
                <p class="t">维修数</p>
                <p class="n">
                  {{ deviceCountInfo.sevenDayReport.repairTotal }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('normal', 2)">
                <p class="t">已完成</p>
                <p class="n">
                  {{ deviceCountInfo.sevenDayReport.normalTotal }}
                </p>
              </div>
            </div>
          </div>
          <div class="nesting">
            <div class="tab-change">
              <span :class="{ active: true }">{{
                deviceCountInfoTabList.monthReport
              }}</span>
            </div>
            <div class="tab-change">
              <span :class="{ active: true }">{{
                deviceCountInfoTabList.yearReport
              }}</span>
            </div>
          </div>
          <div class="layout">
            <!-- 30日 -->
            <div class="repair-total-box">
              <div class="item" @click="getDeviceLogInfo('', 3)">
                <p class="t">故障数</p>
                <p class="n">
                  {{ deviceCountInfo.monthReport.total }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('repairing', 3)">
                <p class="t">维修数</p>
                <p class="n">
                  {{ deviceCountInfo.monthReport.repairTotal }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('normal', 3)">
                <p class="t">已完成</p>
                <p class="n">
                  {{ deviceCountInfo.monthReport.normalTotal }}
                </p>
              </div>
            </div>
            <!-- 今年 -->
            <div class="repair-total-box">
              <div class="item" @click="getDeviceLogInfo('', 4)">
                <p class="t">故障数</p>
                <p class="n">
                  {{ deviceCountInfo.yearReport.total }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('repairing', 4)">
                <p class="t">维修数</p>
                <p class="n">
                  {{ deviceCountInfo.yearReport.repairTotal }}
                </p>
              </div>
              <div class="item" @click="getDeviceLogInfo('normal', 4)">
                <p class="t">已完成</p>
                <p class="n">
                  {{ deviceCountInfo.yearReport.normalTotal }}
                </p>
              </div>
            </div>
          </div>
        </div>
      </app-box>
      <!-- 实时动态 -->
      <div class="cockpit-page-right-b">
        <div class="cockpit-page-right-b-top">
          <app-box class="energy-en" :title="'实时动态'">
            <div class="cockpit-page-head">
              <div class="cockpit-page-head-top">
                <div class="cockpit-page-head-top-box">设备信息</div>
                <div class="cockpit-page-head-top-box">姓名</div>
                <div class="cockpit-page-head-top-box">时间</div>
                <div class="cockpit-page-head-top-box">设备名称</div>
                <div class="cockpit-page-head-top-box">部门</div>
                <div class="cockpit-page-head-top-box">巡检状态</div>
              </div>
              <div class="cockpit-page-text">
                <swiper
                  class="swiper"
                  direction="vertical"
                  :slidesPerView="5"
                  :autoplay="{ disableOnInteraction: true }"
                  :scrollbar="{ draggable: true }"
                >
                  <swiper-slide
                    class="swiper-slide"
                    v-for="(item, index) in lists"
                    :key="index"
                  >
                    <div class="demo-image__preview" style="width: 20%">
                      <el-image
                        class="cockpit-page-text-item-index-img"
                        :src="item.img"
                        @click="(phonedialogVisible = true), indexs(index)"
                        :id="index"
                      />
                    </div>
                    <div class="cockpit-page-text-item-index">
                      {{ item.name }}
                    </div>
                    <div class="cockpit-page-text-item-index">
                      {{ item.time }}
                    </div>
                    <div class="cockpit-page-text-item-index">
                      {{ item.go }}
                    </div>
                    <div class="cockpit-page-text-item-index">
                      {{ item.department }}
                    </div>
                    <div class="cockpit-page-text-item-index">
                      <div class="round"></div>
                      {{ item.tempe }}
                    </div>
                  </swiper-slide>
                </swiper>
              </div>
            </div>
          </app-box>
        </div>
      </div>
    </div>
  </div>
  <!-- 图片的弹窗 -->
  <el-dialog v-model="phonedialogVisible" title="设备信息" width="540px">
    <div
      class="demo-image__preview"
      v-for="(item, index) in indexitem"
      :key="index"
    >
      <el-image
        style="width: 500px; text-align: center"
        :src="item"
        :preview-src-list="indexitem"
        :initial-index="index"
        fit="cover"
      />
    </div>
    <!-- <template #footer>
      <span class="dialog-footer">
        <el-button @click="phonedialogVisible = false">取消</el-button>
        <el-button type="primary" @click="phonedialogVisible = false">确定</el-button>
      </span>
    </template> -->
  </el-dialog>
  <el-dialog
    :close-on-click-modal="true"
    :title="deviceLogDialogTitle"
    v-model="deviceLogDialogVisible"
    width="1200px"
  >
    <el-dialog
      :close-on-click-modal="false"
      width="500px"
      title="报修记录"
      v-model="innerVisible"
      append-to-body
    >
      <div style="height: 600px; overflow: auto">
        <el-collapse v-model="activeNames" class="record-list">
          <el-collapse-item
            :name="`collapse${index}`"
            :key="index"
            v-for="(item, index) in deviceLogRecordInfo"
          >
            <template #title>
              <span class="bx-status" :class="[item.status]">{{
                statusMap[item.status]
              }}</span>
              <h3>第{{ item.report_cnt }}次报修 {{ item.gmt_create }}</h3>
            </template>
            <div>
              <div>巡检员：{{ item.reportName }}</div>
              <div>上传图片</div>
              <div class="image_list">
                <el-image
                  fit="contain"
                  :key="i"
                  v-for="(image, i) in item.report_images"
                  class="image-item"
                  :src="image"
                  :preview-src-list="item.report_images"
                >
                </el-image>
              </div>
              <div>备注：{{ item.report_mark }}</div>
            </div>
            <div>
              <h3>售后时间：{{ item.gmt_modified }}</h3>
              <div>售后员：{{ item.repairName }}</div>
              <div>上传图片</div>
              <div class="image_list">
                <el-image
                  fit="contain"
                  :key="i"
                  v-for="(image, i) in item.repair_images"
                  class="image-item"
                  :src="image"
                  :preview-src-list="item.repair_images"
                >
                </el-image>
              </div>
              <div>备注：{{ item.repair_mark }}</div>
            </div>
          </el-collapse-item>
        </el-collapse>
      </div>
      <el-pagination
        style="text-align: right"
        layout="prev, pager, next"
        :page-size="20"
        @current-change="deviceLogInfoHandleCurrentChange"
        v-model:currentPage="deviceLogInfoForm.page"
        :total="deviceLogRecordInfoToast"
      >
      </el-pagination>
    </el-dialog>

    <el-table
      :data="deviceLogList"
      class="app-table"
      height="400"
      size="small"
      border
    >
      <el-table-column
        label="序号"
        width="100"
        prop="device_log_id"
      ></el-table-column>
      <el-table-column label="品牌" prop="deviceInfo.brand"></el-table-column>
      <el-table-column label="型号" prop="deviceInfo.spec"></el-table-column>
      <el-table-column
        label="位置"
        prop="deviceInfo.coordinate"
      ></el-table-column>
      <el-table-column
        label="部门"
        prop="deviceInfo.deptName"
      ></el-table-column>
      <el-table-column label="售后" prop="reportName">
        <template #default="scope">
          <span v-if="scope.row.reportName == 'testName'" style="color: #a162ff"
            >内部</span
          >
        </template>
      </el-table-column>
      <el-table-column
        label="厂家联系电话"
        prop="deviceInfo.factory_phone"
      ></el-table-column>
      <el-table-column
        label="时间"
        prop="deviceInfo.gmt_create"
      ></el-table-column>
      <el-table-column label="状态" prop="status">
        <template #default="scope">
          <span v-if="scope.row.status == 'success'" style="color: #2fcc95"
            >正常</span
          >
          <span v-if="scope.row.status == 'processing'" style="color: #ff7300"
            >维修中</span
          >
          <span v-if="scope.row.status == 'wait'" style="color: red">报废</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" prop="">
        <template #default="scope">
          <el-button
            type="text"
            size="small"
            @click="deviceLogRecord(scope.row)"
            >维修记录</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      style="text-align: right"
      layout="prev, pager, next"
      :page-size="20"
      @current-change="deviceLogHandleCurrentChange"
      v-model:currentPage="deviceLogForm.page"
      :total="deviceLogTatal"
    >
    </el-pagination>
  </el-dialog>
</template>

<style lang="scss">
.nestinga {
  width: 30%;
  border-left: #000 solid 10px;
}
.round {
  width: 15%;
  height: 15%;
  margin-right: 2px;
  background-color: #2fcc95;
  border-radius: 50%;
}

.layout {
  display: flex;
}

.nesting {
  width: 100%;
  // background-color: #2FCC95;
  display: flex;
  flex-direction: row;
}

.repair-page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  // background-color: #2FCC95;

  .device-configuration-block {
    height: 45%;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;

    .tab-change {
      width: 100%;
      margin-top: 15px;
      border: 1px solid rgba(58, 163, 185, 0.16);
      display: flex;

      span {
        width: 100%;
        height: 32px;
        color: #fff;
        text-align: center;
        cursor: pointer;
        line-height: 32px;
      }

      .active {
        background: #233a57;
        border: 2px solid rgba(25, 48, 90, 0.16);
        margin: 3px;
      }
    }

    .repair-total-box-flex {
      width: 100%;
      height: 45%;
      display: flex;
      flex-direction: column;
    }
  }

  .repair-total-box {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    .item {
      width: 28%;
      height: 80px;
      padding: 10px;
      margin: 5px;
      text-align: center;
      cursor: pointer;

      &:nth-child(1) {
        background: #53b2b1;
      }

      &:nth-child(2) {
        background: #5a71b0;
      }

      &:nth-child(3) {
        background: #f1997c;
      }

      .t {
        font-size: 15px;
        color: #fff;
        margin-bottom: 5px;
      }

      .n {
        font-size: 22px;
        font-family: Impact;
        color: #fff;
      }
    }
  }
}

.normal {
  background: #2fcc95;
}

.broken {
  background: red;
}

.repairing {
  background: #ff7300;
}

.bx-status {
  padding: 5px;
  border-radius: 5px;
  display: inline-block;
  vertical-align: middle;
  line-height: 16px;
  color: #fff;
  font-size: 12px;
  margin-right: 10px;
}

.repair-big {
  height: 70%;
  width: 100%;
  padding-top: 10px;
  display: flex;
}

.content-left {
  width: 100%;
  height: 100%;
  margin-right: 10px;
  // background-color: #2FCC95;
  // border: 1px #318ca2 solid;
}

.content-left-a {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.content-left-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.cockpit-page-right-b {
  margin-top: 10px;
  width: 100%;
  height: calc(55% - 11px);

  // 上
  .cockpit-page-right-b-top {
    width: 100%;
    height: 100%;

    .energy-en {
      width: 100%;
      height: 100%;

      .cockpit-page-head {
        height: calc(100% - 40px);

        .cockpit-page-head-top {
          width: 100%;
          height: 40px;
          margin-top: 5px;
          background-color: #3dabff;
          display: flex;
          justify-content: space-around;
          align-items: center;
          border: 1px solid rgba(2, 186, 219, 0.4);
          background: linear-gradient(
            0deg,
            rgba(29, 29, 29, 0.4) 52%,
            rgba(61, 171, 255, 0.2)
          );

          .cockpit-page-head-top-box {
            width: 20%;
            text-align: center;
            font-size: 14px;
          }
        }

        .cockpit-page-text {
          // margin-top: 10px;
          height: calc(100% - 70px);

          .swiper {
            width: 100%;
            height: 100%;
            margin-top: 10px;
          }

          .swiper-slide {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: space-between;

            .cockpit-page-text-item-index {
              width: 20%;
              height: 90%;
              color: #aad3fb;
              font-size: 14px;
              text-align: center;
              display: flex;
              align-items: center;
              justify-content: center;
            }

            .cockpit-page-text-item-index-img {
              margin-left: 14px;
              padding-top: 5px;
              height: 100%;
              width: 100%;
              display: flex;
              align-items: center;
              justify-content: center;
            }
          }
        }
      }
    }
  }
}

.visual-left {
  height: 100%;
  flex: 1;

  .camera-hover .hover {
    display: none;
  }

  .camera-hover:hover .hover {
    display: block;
  }

  .map-block {
    height: 100%;
    // border: 1px solid #318ca2;
    overflow: hidden !important;
    position: relative;
  }

  // .map-block img{
  //   width: auto;
  // height: auto;
  // }

  .map-id {
    display: inline-block;
    position: absolute;
    cursor: pointer;
  }

  .map-loading {
    color: #fff;
    position: absolute;
    left: 0;
    width: 100%;
    top: 50%;
    text-align: center;
  }

  .map-id .index-point {
    width: 0;
    height: 0;
    position: absolute;
  }

  .map-id .index-point img {
    position: absolute;
    width: 100px;
    left: -100px;
    bottom: 0;
  }
}
.deviceDeta-box {
  display: flex;
  justify-content: space-between;
  .deviceDeta-l {
    width: 48%;
    font-size: 16px;
    line-height: 40px;
    .deviceDeta-l-span {
      color: #51c1f5;
      font-size: 16px;
    }
  }
  .deviceDeta-r {
    width: 48%;
    font-size: 16px;
    line-height: 40px;
    .deviceDeta-l-span {
      color: #51c1f5;
      font-size: 16px;
    }
    .deviceDeta-l-status-a {
      color: #61e74f;
      font-size: 16px;
    }
    .deviceDeta-l-status-b {
      color: #e7691f;
      font-size: 16px;
    }
    .deviceDeta-l-status-c {
      color: #e20c0c;
      font-size: 16px;
    }
  }
}
</style>
